<template>
  <div class="permissions">
    <!-- 面包屑导航 -->
    <separator :nameList='newNameList'></separator>
    <!-- 卡片 -->
    <el-card>
      <el-table :data="rightsTableData" border style="width: 100%" stripe>
        <el-table-column  type="index"></el-table-column>
        <el-table-column  prop="authName" label="权限名称"></el-table-column>
        <el-table-column  prop="path" label="路径"></el-table-column>
        <el-table-column  prop="level" label="权限等级">
          <template slot-scope="scope">
             <el-button v-if = 'scope.row.level==1' type="primary" plain size='small'>一级</el-button>
             <el-button v-else-if = 'scope.row.level==2' type="success" plain size='small'>二级</el-button>
             <el-button v-else = 'scope.row.level==3' type="warning" plain size='small'>三级</el-button>
          </template>
        </el-table-column>
      </el-table>

    </el-card>
  </div>
</template>

<script>
  import Separator from 'components/content/separator/Separator'
  import {getRightList} from 'network/power/rights'
  export default {
    name:'Rights',
    components:{
      Separator
    },
    created(){
      this._getRightList(this.type);
    },
    data(){
      return {
        newNameList:['权限管理','权限列表'],
        type:'list',
        rightsTableData:[]
      }
    },
    methods:{
      _getRightList(type){
        getRightList(type).then(res=>{
          this.rightsTableData = res.data.data;
          if(res.data.meta.status!==200){
            return this.$methods.error('用户列表获取失败');
          }
        },err=>{
          console.log(errr);
        })
      }
    }
  }
</script>

<style lang="less" scoped>

</style>